﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HQHS.Library.DAL.Menu.Sprocs
{
    public class Menu_LoadByType_p : GOTCommandBase
    {
        private ParametersClass _params;
        public Menu_LoadByType_p()
        {
            SqlParameter p;

            this.SqlCommand.CommandText = "Menu_LoadByType_p";
            this.SqlCommand.CommandType = CommandType.StoredProcedure;

            p = this.SqlCommand.Parameters.Add("@RETURN_VALUE", SqlDbType.Int, 0);
            p.Direction = ParameterDirection.ReturnValue;
            this.SqlCommand.Parameters.Add("@type", SqlDbType.TinyInt, 0);
        }

        #region  Public Properties
        public ParametersClass Parameters
        {
            get
            {
                if (_params == null)
                {
                    _params = new ParametersClass(this.SqlCommand);
                }
                return _params;
            }
        }
        #endregion

        #region  Parameters Class
        /// <summary>
        /// 
        /// </summary>
        public class ParametersClass
        {
            private SqlCommand _cmd;

            public ParametersClass(SqlCommand cmd)
            {
                _cmd = cmd;
            }

            public int? Return_Value
            {
                set
                {
                    if (value != null)
                    {
                        _cmd.Parameters["@Return_Value"].Value = value;
                    }
                    else
                    {
                        _cmd.Parameters["@Return_Value"].Value = System.DBNull.Value;
                    }
                }
            }
            public byte? Type
            {
                set
                {
                    if (value != null)
                    {
                        _cmd.Parameters["@type"].Value = value;
                    }
                    else
                    {
                        _cmd.Parameters["@type"].Value = 1;
                    }
                }
            }
        }
        #endregion
    }
}
